<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true"
    CodeFile="Tasks.aspx.cs" Inherits="Workflow_Tasks" Title="APM - Update Task Status" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <ul id="path">
        <li><a href="../Home.aspx">Home</a> &gt;</li>
        <li>Workflow/Tasks &gt;</li>
        <li>Update Task Status</li>
    </ul>
    <h3 class="status"><span>Update Task Status</span></h3>
    <div id="content">
        <p>
        </p>
        <asp:Panel ID="pnlSearch" runat="server" Width="100%">
            <table class="table">
                <tr align="center">
                    <th colspan="2">
                        Quick Search</th>
                </tr>
                <tr>
                </tr>
                <tr>
                    <td align="left" colspan="2" style="padding: 0 0 0 0;">
                        <asp:RadioButtonList ToolTip="Select to search by Application Name or by Application ID."
                            runat="server" ID="rdsearchType" AutoPostBack="false" TextAlign="Right" RepeatDirection="Horizontal">
                            <asp:ListItem Selected="true" Value="0"> Search by Application Name</asp:ListItem>
                            <asp:ListItem Value="1">Search by Application ID</asp:ListItem>
                        </asp:RadioButtonList>
                    </td>
                </tr>
                <tr>
                    <td align="left" colspan="2" style="padding: 0 0 0 0;">
                        <table cellpadding="0" cellspacing="0">
                            <tr>
                                <td>
                                    <asp:TextBox ValidationGroup="search" CssClass="input" ID="txtSearch" Width="220"
                                        runat="server" MaxLength="50"></asp:TextBox>
                                    <asp:Button ID="btnSearch" runat="server" ValidationGroup="search" OnClick="btnSearch_Click" CausesValidation="true"
                                        Text="Search" />
                                </td>
                                <td>
                                    <asp:RequiredFieldValidator ValidationGroup="search" ID="reqAppName" runat="server"
                                        ControlToValidate="txtSearch" ErrorMessage="Required Field: Application Name/ID"
                                        Display="None" SetFocusOnError="True"></asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="reguAppName" runat="server" ControlToValidate="txtSearch"
                                        Display="None" ErrorMessage="Invalid Input: Application Name/ID" ValidationExpression="<%$ AppSettings:AppNameRegEx %>"
                                        ValidationGroup="search"></asp:RegularExpressionValidator>
                                    &nbsp;Example - Microsoft Word or 56</td>
                                <asp:ValidationSummary ValidationGroup="search" ID="commonValidation" runat="server"
                                    HeaderText="Please correct the following:" ShowMessageBox="true" ShowSummary="false"
                                    DisplayMode="BulletList" />
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td align="left" colspan="2">
                        <asp:Label ID="lblResult" runat="server" Text="Select Application" Visible="false"></asp:Label>
                    </td>
                </tr>
                <tr>
                    <td align="left" colspan="2">
                        <asp:ListBox Width="275" ID="lstApplicationNames" Rows="5" runat="server" Visible="False">
                        </asp:ListBox>
                        <asp:RequiredFieldValidator ValidationGroup="Go" ID="RequiredFieldValidator1" runat="server"
                            ControlToValidate="lstApplicationNames" ErrorMessage="No application was selected."
                            Display="None" SetFocusOnError="True"></asp:RequiredFieldValidator>
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="left">
                        <asp:Button ID="btnGo" runat="server" ValidationGroup="Go" Text="Select" Visible="false" OnClick="btnGo_Click" />
                        <asp:ValidationSummary ValidationGroup="Go" ID="ValidationSummary1" runat="server"
                            HeaderText="Please correct the following:" ShowMessageBox="true" ShowSummary="false"
                            DisplayMode="BulletList" />
                    </td>
                </tr>
            </table>
        </asp:Panel>
        <asp:Panel ID="pnlAppTask" runat="server" BorderColor="Silver" BorderWidth="1px"
            Visible="false" Width="100%">
            <asp:Panel ID="Panel1" BorderWidth="10" BorderColor="White" runat="server">
                <h4>
                    Application Information</h4>
                <asp:Label ID="lblAppIDText" runat="server" CssClass="current">Application ID:</asp:Label>
                <asp:Label ID="lblAppID" runat="server"></asp:Label><asp:HiddenField id="hfAppID" runat="server" Visible="false" />
                <br />
                <asp:Label ID="lblAppInfoText" runat="server" CssClass="current">Application Name:</asp:Label>
                <asp:Label ID="lblAppName" runat="server"></asp:Label>
                <br />
                <asp:Label CssClass="current" ID="lblVersionText" runat="server">Version Number:</asp:Label>
                <asp:Label ID="lblVersion" runat="server"></asp:Label>
                <br />
                <asp:Label CssClass="current" ID="lblStatusText" runat="server">Summary Task Status:</asp:Label>
                <font color='red'>
                    <asp:Label ID="lblStatus" runat="server"></asp:Label></font>
                <asp:Panel ID="pnlError" runat="server" Visible="false">
                    <asp:Label CssClass="current" ID="lblErrorText" runat="server">Status Details:</asp:Label>
                    <font color='red'>
                        <asp:Label ID="lblError" runat="server"></asp:Label></font>
                </asp:Panel>
                <asp:Panel ID="pnlLifeCycle" runat="server">
                    <hr />
                    <h4>
                        Task Status</h4>
                    <table width="100%" style="vertical-align: top;" border ="0">
                        <asp:Repeater ID="rptLifeCycle" runat="server" OnItemDataBound="rptLifeCycle_ItemDataBound">
                            <ItemTemplate>
                                <tr>
                                    <td>
                                        <asp:TextBox CssClass="input" ID="txtLifeCycleID" Text='<%# Eval("LifeCycleID") %>'
                                            runat="server" ReadOnly="true" Visible="false"></asp:TextBox>
                                        <asp:Label ID="lblLifeCycle" Text='<%# Microsoft.Security.Application.AntiXss.HtmlEncode(Eval("LifeCycleName").ToString()) %>'
                                            Font-Bold="true" runat="server"></asp:Label>
                                        <asp:Label ID="lblNoTasks" runat="server"></asp:Label>
                                    </td>
                                    <td>
                                        Completed Date</td>
                                        <td>
                                        Status</td>
                                </tr>
                                <asp:Repeater ID="rptTasks" runat="server">
                                    <ItemTemplate>
                                        <tr valign="top">
                                            <td style="width: 450px;">
                                                <asp:TextBox ID="txtTaskID" Text='<%# Eval("ApplicationTaskID") %>' runat="server"
                                                    ReadOnly="true" Visible="false"></asp:TextBox>
                                                <asp:Label ID="lblTaskName" Text='<%# Microsoft.Security.Application.AntiXss.HtmlEncode(Eval("TaskName").ToString()) %>'
                                                    runat="server"></asp:Label>
                                            </td>
                                            <td valign="bottom" style ="width :110px" >
                                                <asp:TextBox CssClass="input" ID="txtCompletedDate" Text='<%# Eval("Completeddate") %>'
                                                    Width="75" runat="server" Enabled="true"></asp:TextBox>
                                                <asp:CompareValidator ID="CompareValidator1" ValidationGroup="Submit" runat="server"
                                                    Operator="DataTypeCheck" ControlToValidate="txtCompletedDate" Type="date" ErrorMessage="Invalid Input: Completed Date"
                                                    Display="none"></asp:CompareValidator>
                                                <asp:CompareValidator ID="cmpSqlDate" runat="server" ControlToValidate="txtCompletedDate"
                                                    Display="None" ErrorMessage="Invalid Input: Completed Date. The system supports dates greater than 1/1/1753." Operator="GreaterThan"
                                                    SetFocusOnError="True" Type="Date" ValidationGroup="Submit" ValueToCompare="1/1/1753"></asp:CompareValidator>
                                                <asp:Label ID="lblCompletedDate" runat="server" Style="vertical-align: top; height: 19px;
                                                    width: 18px; border: 0px;">
                                                    <asp:PlaceHolder ID="phCompletedDate" runat="server"></asp:PlaceHolder>
                                                </asp:Label><cc1:CalendarExtender ID="ceCompletedDate" TargetControlID="txtCompletedDate"
                                                    PopupButtonID="imgCompleteDate" runat="server">
                                                </cc1:CalendarExtender>
                                            </td>               
                                            <td style =' background-color :<%# ReturnColorStatus(Eval("Completeddate") + string.Empty ) %>; width : 50px;' align ="left"  >
                                            &nbsp;
                                            </td>                             
                                        </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
                            </ItemTemplate>
                            <SeparatorTemplate>
                            </SeparatorTemplate>
                            <FooterTemplate>
                                <tr >
                                    <td align ="left" colspan ="3" >
                                    <lable><font color='#804040' > Note: The date format should be 'mm/dd/yyyy'.</font></lable>
                                    </td>
                                </tr>
                            </FooterTemplate>
                        </asp:Repeater>
                    </table>
                </asp:Panel>
                <asp:Panel ID="pnlButtons" runat="server" Visible="true" Width="100%">
                    <table width="100%" style="vertical-align: top;">
                        <tr>
                            <td colspan="2">
                                <br />
                                <asp:Button ID="btnSubmit" ValidationGroup="Submit" OnClick="SubmitClick" runat="server"
                                    Text="Save" />
                                <asp:Button ID="btnCancel" OnClick="CancelClick" runat="server" Text="Back" />
                                <asp:ValidationSummary ID="vsOrganization" ValidationGroup="Submit" runat="server"
                                    HeaderText="Please correct the following:" ShowMessageBox="true" ShowSummary="false"
                                    DisplayMode="BulletList" />
                            </td>
                        </tr>
                    </table>
                </asp:Panel>
            </asp:Panel>
        </asp:Panel>
    </div>
</asp:Content>
